import { createRouter, createWebHashHistory } from 'vue-router'
import index from '../views'
import home from '../views/pages/home.vue'
import login from '../views/pages/login.vue'
import smsLogin from '../views/pages/smsLogin.vue'
import newsList from '@/views/pages/news/list'
import chuangyezheList from '@/views/pages/chuangyezhe/list'
import chuangyezheDetail from '@/views/pages/chuangyezhe/formModel'
import chuangyezheAdd from '@/views/pages/chuangyezhe/formAdd'
import chuangyezheRegister from '@/views/pages/chuangyezhe/register'
import chuangyezheCenter from '@/views/pages/chuangyezhe/center'
import personalfile from '@/views/pages/chuangyezhe/personalfile'
import xiangmufenleiList from '@/views/pages/xiangmufenlei/list'
import xiangmufenleiDetail from '@/views/pages/xiangmufenlei/formModel'
import xiangmufenleiAdd from '@/views/pages/xiangmufenlei/formAdd'
import xiangmuchengguoList from '@/views/pages/xiangmuchengguo/list'
import xiangmuchengguoDetail from '@/views/pages/xiangmuchengguo/formModel'
import xiangmuchengguoAdd from '@/views/pages/xiangmuchengguo/formAdd'
import daoshiList from '@/views/pages/daoshi/list'
import daoshiDetail from '@/views/pages/daoshi/formModel'
import daoshiAdd from '@/views/pages/daoshi/formAdd'
import daoshiRegister from '@/views/pages/daoshi/register'
import daoshiCenter from '@/views/pages/daoshi/center'
import storeupList from '@/views/pages/storeup/list'
import xiangmuxinxiList from '@/views/pages/xiangmuxinxi/list'
import xiangmuxinxiDetail from '@/views/pages/xiangmuxinxi/formModel'
import xiangmuxinxiAdd from '@/views/pages/xiangmuxinxi/formAdd'
import huodongleixingList from '@/views/pages/huodongleixing/list'
import huodongleixingDetail from '@/views/pages/huodongleixing/formModel'
import huodongleixingAdd from '@/views/pages/huodongleixing/formAdd'
import chuangyehuodongList from '@/views/pages/chuangyehuodong/list'
import chuangyehuodongDetail from '@/views/pages/chuangyehuodong/formModel'
import chuangyehuodongAdd from '@/views/pages/chuangyehuodong/formAdd'
import chuangyedasaiList from '@/views/pages/chuangyedasai/list'
import chuangyedasaiDetail from '@/views/pages/chuangyedasai/formModel'
import chuangyedasaiAdd from '@/views/pages/chuangyedasai/formAdd'
import zhishichanquanList from '@/views/pages/zhishichanquan/list'
import zhishichanquanDetail from '@/views/pages/zhishichanquan/formModel'
import zhishichanquanAdd from '@/views/pages/zhishichanquan/formAdd'
import xiangmushenqingList from '@/views/pages/xiangmushenqing/list'
import xiangmushenqingDetail from '@/views/pages/xiangmushenqing/formModel'
import xiangmushenqingAdd from '@/views/pages/xiangmushenqing/formAdd'
import chatMessageList from '@/views/pages/chatMessage/list'
import chatMessageDetail from '@/views/pages/chatMessage/formModel'
import chatMessageAdd from '@/views/pages/chatMessage/formAdd'
import chatFriendList from '@/views/pages/chatFriend/list'
import chatFriendDetail from '@/views/pages/chatFriend/formModel'
import chatFriendAdd from '@/views/pages/chatFriend/formAdd'
import chengguofenleiList from '@/views/pages/chengguofenlei/list'
import chengguofenleiDetail from '@/views/pages/chengguofenlei/formModel'
import chengguofenleiAdd from '@/views/pages/chengguofenlei/formAdd'
import chengguobiaozhangList from '@/views/pages/chengguobiaozhang/list'
import chengguobiaozhangDetail from '@/views/pages/chengguobiaozhang/formModel'
import chengguobiaozhangAdd from '@/views/pages/chengguobiaozhang/formAdd'
import yaoqingxinxiList from '@/views/pages/yaoqingxinxi/list'
import yaoqingxinxiDetail from '@/views/pages/yaoqingxinxi/formModel'
import yaoqingxinxiAdd from '@/views/pages/yaoqingxinxi/formAdd'
import shijiguanliyuanList from '@/views/pages/shijiguanliyuan/list'
import shijiguanliyuanDetail from '@/views/pages/shijiguanliyuan/formModel'
import shijiguanliyuanAdd from '@/views/pages/shijiguanliyuan/formAdd'
import qujiguanliyuanList from '@/views/pages/qujiguanliyuan/list'
import qujiguanliyuanDetail from '@/views/pages/qujiguanliyuan/formModel'
import qujiguanliyuanAdd from '@/views/pages/qujiguanliyuan/formAdd'
import jiedaoguanliyuanList from '@/views/pages/jiedaoguanliyuan/list'
import jiedaoguanliyuanDetail from '@/views/pages/jiedaoguanliyuan/formModel'
import jiedaoguanliyuanAdd from '@/views/pages/jiedaoguanliyuan/formAdd'
import xuexiaoguanliyuanList from '@/views/pages/xuexiaoguanliyuan/list'
import xuexiaoguanliyuanDetail from '@/views/pages/xuexiaoguanliyuan/formModel'
import xuexiaoguanliyuanAdd from '@/views/pages/xuexiaoguanliyuan/formAdd'
import xueyuanguanliyuanList from '@/views/pages/xueyuanguanliyuan/list'
import xueyuanguanliyuanDetail from '@/views/pages/xueyuanguanliyuan/formModel'
import xueyuanguanliyuanAdd from '@/views/pages/xueyuanguanliyuan/formAdd'
import chengshiList from '@/views/pages/chengshi/list'
import chengshiDetail from '@/views/pages/chengshi/formModel'
import chengshiAdd from '@/views/pages/chengshi/formAdd'
import yuanquList from '@/views/pages/yuanqu/list'
import yuanquDetail from '@/views/pages/yuanqu/formModel'
import yuanquAdd from '@/views/pages/yuanqu/formAdd'
import jiedaoList from '@/views/pages/jiedao/list'
import jiedaoDetail from '@/views/pages/jiedao/formModel'
import jiedaoAdd from '@/views/pages/jiedao/formAdd'
import emailregistercodeList from '@/views/pages/emailregistercode/list'
import emailregistercodeDetail from '@/views/pages/emailregistercode/formModel'
import emailregistercodeAdd from '@/views/pages/emailregistercode/formAdd'

const routes = [{
		path: '/',
		redirect: '/index/home'
	},
	{
		path: '/index',
		component: index,
		children: [{
			path: 'home',
			component: home
		}
		, {
			path: 'newsList',
			component: newsList
		}
		, {
			path: 'chuangyezheList',
			component: chuangyezheList
		}, {
			path: 'chuangyezheDetail',
			component: chuangyezheDetail
		}, {
			path: 'chuangyezheAdd',
			component: chuangyezheAdd
		}
		, {
			path: 'chuangyezheCenter',
			component: chuangyezheCenter
		}
		, {
			path: 'pingdingdengjiList',
			component: personalfile
		}
		, {
			path: 'xiangmufenleiList',
			component: xiangmufenleiList
		}, {
			path: 'xiangmufenleiDetail',
			component: xiangmufenleiDetail
		}, {
			path: 'xiangmufenleiAdd',
			component: xiangmufenleiAdd
		}
		, {
			path: 'xiangmuchengguoList',
			component: xiangmuchengguoList
		}, {
			path: 'xiangmuchengguoDetail',
			component: xiangmuchengguoDetail
		}, {
			path: 'xiangmuchengguoAdd',
			component: xiangmuchengguoAdd
		}
		, {
			path: 'daoshiList',
			component: daoshiList
		}, {
			path: 'daoshiDetail',
			component: daoshiDetail
		}, {
			path: 'daoshiAdd',
			component: daoshiAdd
		}
		, {
			path: 'daoshiCenter',
			component: daoshiCenter
		}
        , {
            path: 'storeupList',
            component: storeupList
        }
		, {
			path: 'xiangmuxinxiList',
			component: xiangmuxinxiList
		}, {
			path: 'xiangmuxinxiDetail',
			component: xiangmuxinxiDetail
		}, {
			path: 'xiangmuxinxiAdd',
			component: xiangmuxinxiAdd
		}
		, {
			path: 'huodongleixingList',
			component: huodongleixingList
		}, {
			path: 'huodongleixingDetail',
			component: huodongleixingDetail
		}, {
			path: 'huodongleixingAdd',
			component: huodongleixingAdd
		}
		, {
			path: 'chuangyehuodongList',
			component: chuangyehuodongList
		}, {
			path: 'chuangyehuodongDetail',
			component: chuangyehuodongDetail
		}, {
			path: 'chuangyehuodongAdd',
			component: chuangyehuodongAdd
		}
		, {
			path: 'chuangyedasaiList',
			component: chuangyedasaiList
		}, {
			path: 'chuangyedasaiDetail',
			component: chuangyedasaiDetail
		}, {
			path: 'chuangyedasaiAdd',
			component: chuangyedasaiAdd
		}
		, {
			path: 'zhishichanquanList',
			component: zhishichanquanList
		}, {
			path: 'zhishichanquanDetail',
			component: zhishichanquanDetail
		}, {
			path: 'zhishichanquanAdd',
			component: zhishichanquanAdd
		}
		, {
			path: 'xiangmushenqingList',
			component: xiangmushenqingList
		}, {
			path: 'xiangmushenqingDetail',
			component: xiangmushenqingDetail
		}, {
			path: 'xiangmushenqingAdd',
			component: xiangmushenqingAdd
		}
		, {
			path: 'chatMessageList',
			component: chatMessageList
		}, {
			path: 'chatMessageDetail',
			component: chatMessageDetail
		}, {
			path: 'chatMessageAdd',
			component: chatMessageAdd
		}
		, {
			path: 'chatFriendList',
			component: chatFriendList
		}, {
			path: 'chatFriendDetail',
			component: chatFriendDetail
		}, {
			path: 'chatFriendAdd',
			component: chatFriendAdd
		}
		, {
			path: 'chengguofenleiList',
			component: chengguofenleiList
		}, {
			path: 'chengguofenleiDetail',
			component: chengguofenleiDetail
		}, {
			path: 'chengguofenleiAdd',
			component: chengguofenleiAdd
		}
		, {
			path: 'chengguobiaozhangList',
			component: chengguobiaozhangList
		}, {
			path: 'chengguobiaozhangDetail',
			component: chengguobiaozhangDetail
		}, {
			path: 'chengguobiaozhangAdd',
			component: chengguobiaozhangAdd
		}
		, {
			path: 'yaoqingxinxiList',
			component: yaoqingxinxiList
		}, {
			path: 'yaoqingxinxiDetail',
			component: yaoqingxinxiDetail
		}, {
			path: 'yaoqingxinxiAdd',
			component: yaoqingxinxiAdd
		}
		, {
			path: 'shijiguanliyuanList',
			component: shijiguanliyuanList
		}, {
			path: 'shijiguanliyuanDetail',
			component: shijiguanliyuanDetail
		}, {
			path: 'shijiguanliyuanAdd',
			component: shijiguanliyuanAdd
		}
		, {
			path: 'qujiguanliyuanList',
			component: qujiguanliyuanList
		}, {
			path: 'qujiguanliyuanDetail',
			component: qujiguanliyuanDetail
		}, {
			path: 'qujiguanliyuanAdd',
			component: qujiguanliyuanAdd
		}
		, {
			path: 'jiedaoguanliyuanList',
			component: jiedaoguanliyuanList
		}, {
			path: 'jiedaoguanliyuanDetail',
			component: jiedaoguanliyuanDetail
		}, {
			path: 'jiedaoguanliyuanAdd',
			component: jiedaoguanliyuanAdd
		}
		, {
			path: 'xuexiaoguanliyuanList',
			component: xuexiaoguanliyuanList
		}, {
			path: 'xuexiaoguanliyuanDetail',
			component: xuexiaoguanliyuanDetail
		}, {
			path: 'xuexiaoguanliyuanAdd',
			component: xuexiaoguanliyuanAdd
		}
		, {
			path: 'xueyuanguanliyuanList',
			component: xueyuanguanliyuanList
		}, {
			path: 'xueyuanguanliyuanDetail',
			component: xueyuanguanliyuanDetail
		}, {
			path: 'xueyuanguanliyuanAdd',
			component: xueyuanguanliyuanAdd
		}
		, {
			path: 'chengshiList',
			component: chengshiList
		}, {
			path: 'chengshiDetail',
			component: chengshiDetail
		}, {
			path: 'chengshiAdd',
			component: chengshiAdd
		}
		, {
			path: 'yuanquList',
			component: yuanquList
		}, {
			path: 'yuanquDetail',
			component: yuanquDetail
		}, {
			path: 'yuanquAdd',
			component: yuanquAdd
		}
		, {
			path: 'jiedaoList',
			component: jiedaoList
		}, {
			path: 'jiedaoDetail',
			component: jiedaoDetail
		}, {
			path: 'jiedaoAdd',
			component: jiedaoAdd
		}
		, {
			path: 'emailregistercodeList',
			component: emailregistercodeList
		}, {
			path: 'emailregistercodeDetail',
			component: emailregistercodeDetail
		}, {
			path: 'emailregistercodeAdd',
			component: emailregistercodeAdd
		}
		]
	},
	{
		path: '/login',
		component: login
	},
	{
		path: '/smsLogin',
		component: smsLogin
	},
	{
		path: '/chuangyezheRegister',
		component: chuangyezheRegister
	},
	{
		path: '/daoshiRegister',
		component: daoshiRegister
	},
	{
		path: '/forget',
		name: 'forget',
		component: () => import('../views/pages/forget.vue')
	},

]

const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes
})

// 添加全局前置守卫
router.beforeEach((to, from) => {
  // 当导航到项目信息列表时，如果是从其他页面跳转过来，则清除状态
  if (to.path === '/index/xiangmuxinxiList' && from.path && from.path !== '/index/xiangmuxinxiList') {
    localStorage.removeItem('xiangmuxinxi_centerType')
    localStorage.removeItem('xiangmuxinxi_fuzerenzhanghao')
  }
})

export default router
